@namespace MduiBlazor
@typeparam TValue
@typeparam TItem
@inherits MduiInputBase<TValue?>
@implements IPicker<TValue>

<div class="@Classname" style="@Style" @attributes="@AdditionalAttributes">
    <input class="@InputClassname" value="@DisplayValue" readonly="@_readonly" disabled="@Disabled"
        placeholder="@Placeholder" autofocus="@AutoFocus" required="@Required" @oninput="@OnInput"
        @onfocus="@OnPickerFocus" />
    <ul class="@ContentClassname" style="@ContentStylelist">
        <CascadingValue Value="@this">
            @if (ChildContent is not null)
            {
                @ChildContent
            }
            else
            {
                if (Items is not null && ValueFunc is not null && DisplayStringFunc is not null)
                {
                    foreach (var item in Items)
                    {
                        <MduiPickerItem Value="@ValueFunc(item)" DisplayString="@DisplayStringFunc(item)">
                            @if (OptionContent is not null)
                            {
                                @OptionContent(item)
                            }
                            else
                            {
                                @DisplayStringFunc(item)
                            }
                        </MduiPickerItem>
                    }
                }
            }
        </CascadingValue>
    </ul>
</div>

<MduiOverlay Transparent Visible="@_isOpen" OnBackgroundClick="@OnClickBackground" />